{% extends "base.html" %}

{% block title %}PPT{% endblock title %}


{% block page_content %}
<form role="form" method="post" action="/ppt/upload">
    <div class="form-group">
        <label for="levelOneDir">一级目录:</label>
        <select id="levelOneDir" class="form-control" style="width:500px;">
            {% for item in root_dirs %}
                <option value="{{ item }}">{{ item }}</option>
            {% endfor %}
        </select>
        <button type="submit" id="new_btn" class="btn btn-primary" onclick="newdir()">新增</button>
    </div>

    <div class="form-group">
        <label for="secDir">二级目录:</label>
        <input type="text" class="form-control" id="secDir" placeholder="输入二级目录名称e.g. B or /B or /B/" style="width:500px;">
    </div>
    <div class="form-group">
        <label for="uploadFile">上传文件</label>
        <input type="file" id="uploadFile" name="uploadFile" multiple="multiple">
    </div>
 
   <p><font color="red"><strong>*** 注意:允许上传 zip/rar/7z/tar.gz/ppt/pptx/xls/xlsx/doc/docx ***</strong></font></p>
   <p><font color="red"><strong>*** 注意:无需创建二级目录时，二级目录输入框可以留空 ***</strong></font></p>

   <button type="submit" class="btn btn-primary" onclick="return validate()">上传</button>
</form>
{% endblock %}

{% block scripts %}
{{ super() }}

<script>
   function validate()
    {
      var selected_files = $("#uploadFile")["0"].files;
      if(selected_files.length == 0){
          console.log("length is 0");
          return false;
     }
     else
     {
      console.log(selected_files);
      return true;
     }
    }
</script>
{% endblock %}

